using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VEKKOPF
    {
        public void SetUpNewRow(ref DataRow dwReturn, DataRow dwInput)
        {
            #region
            #endregion
            switch (app.company)
            {
                case "YGR":
                case "SXN":
                case "TST":
                default:
                    #region
                    dwReturn["EKKMANDANT"] = app.Mandant;
                    dwReturn["EKKAUFKRS"] = "  ";
                    dwReturn["EKKAUFLFD"] = "000000";
                    dwReturn["EKKAENZL"] = "0";
                    dwReturn["EKKAENB"] = "        ";
                    dwReturn["EKKAEND"] = "0";
                    dwReturn["EKKNEUB"] = "        ";
                    dwReturn["EKKNEUD"] = "0";
                    dwReturn["EKKAUFGRP"] = "B";
                    dwReturn["EKKAUFART"] = "BE";
                    dwReturn["EKKARTGR"] = "1";
                    dwReturn["EKKZEICH"] = "              ";
                    dwReturn["EKKAKKRED"] = "               ";
                    dwReturn["EKKSACHB"] = "        ";
                    dwReturn["EKKRSTBEZ"] = "      ";
                    dwReturn["EKKLIEFKOMP"] = " ";
                    dwReturn["EKKLIEFNR"] = "00000000";
                    dwReturn["EKKBADR"] = " ";
                    dwReturn["EKKLADR"] = " ";
                    dwReturn["EKKRADR"] = " ";
                    dwReturn["EKKKONDSL"] = "STD ";
                    dwReturn["EKKWAEHRSL"] = "RMB";
                    dwReturn["EKKPREISLST"] = "     ";
                    dwReturn["EKKKNTRNRL"] = "               ";
                    dwReturn["EKKKOKRS"] = "  ";
                    dwReturn["EKKKOLFD"] = "      ";
                    dwReturn["EKKBDAT"] = "0";
                    dwReturn["EKKDATV"] = "0";
                    dwReturn["EKKDATB"] = "0";
                    dwReturn["EKKANLFRLNR"] = "        ";
                    dwReturn["EKKADRZU"] = "    ";
                    dwReturn["EKKLO"] = "01";
                    dwReturn["EKKLB"] = "  ";
                    dwReturn["EKKLP"] = "        ";
                    dwReturn["EKKLIZENZME"] = "0";
                    dwReturn["EKKVERBRME"] = "0";
                    dwReturn["EKKME1"] = "0";
                    dwReturn["EKKME2"] = "0";
                    dwReturn["EKKME3"] = "0";
                    dwReturn["EKKME4"] = "0";
                    dwReturn["EKKME5"] = "0";
                    dwReturn["EKKME6"] = "0";
                    dwReturn["EKKME7"] = "0";
                    dwReturn["EKKME8"] = "0";
                    dwReturn["EKKME9"] = "0";
                    dwReturn["EKKME10"] = "0";
                    dwReturn["EKKWE1"] = "0";
                    dwReturn["EKKWE2"] = "0";
                    dwReturn["EKKWE3"] = "0";
                    dwReturn["EKKWE4"] = "0";
                    dwReturn["EKKWE5"] = "0";
                    dwReturn["EKKWE6"] = "0";
                    dwReturn["EKKWE7"] = "0";
                    dwReturn["EKKWE8"] = "0";
                    dwReturn["EKKWE9"] = "0";
                    dwReturn["EKKWE10"] = "0";
                    dwReturn["EKKGESSTA"] = "  ";
                    dwReturn["EKKEINSTA"] = "  ";
                    dwReturn["EKKBUCHKRS"] = "   ";
                    dwReturn["EKKABLADEST"] = "    ";
                    dwReturn["EKKATEXTSL"] = "   ";
                    dwReturn["EKKSTKZAEHL"] = "0000";
                    dwReturn["EKKRABART1"] = "   ";
                    dwReturn["EKKRABPROZ1"] = "0";
                    dwReturn["EKKRABART2"] = "   ";
                    dwReturn["EKKRABPROZ2"] = "0";
                    dwReturn["EKKRABART3"] = "   ";
                    dwReturn["EKKRABPROZ3"] = "0";
                    dwReturn["EKKRABART4"] = "   ";
                    dwReturn["EKKRABPROZ4"] = "0";
                    dwReturn["EKKRABART5"] = "   ";
                    dwReturn["EKKRABPROZ5"] = "0";
                    dwReturn["EKKZUAB1"] = "   ";
                    dwReturn["EKKZUABPR1"] = "0";
                    dwReturn["EKKZUABWE1"] = "0";
                    dwReturn["EKKZUABME1"] = "   ";
                    dwReturn["EKKABRKZ1"] = " ";
                    dwReturn["EKKZUAB2"] = "   ";
                    dwReturn["EKKZUABPR2"] = "0";
                    dwReturn["EKKZUABWE2"] = "0";
                    dwReturn["EKKZUABME2"] = "   ";
                    dwReturn["EKKABRKZ2"] = " ";
                    dwReturn["EKKZUAB3"] = "   ";
                    dwReturn["EKKZUABPR3"] = "0";
                    dwReturn["EKKZUABWE3"] = "0";
                    dwReturn["EKKZUABME3"] = "   ";
                    dwReturn["EKKABRKZ3"] = " ";
                    dwReturn["EKKZUAB4"] = "   ";
                    dwReturn["EKKZUABPR4"] = "0";
                    dwReturn["EKKZUABWE4"] = "0";
                    dwReturn["EKKZUABME4"] = "   ";
                    dwReturn["EKKABRKZ4"] = " ";
                    dwReturn["EKKZUAB5"] = "   ";
                    dwReturn["EKKZUABPR5"] = "0";
                    dwReturn["EKKZUABWE5"] = "0";
                    dwReturn["EKKZUABME5"] = "   ";
                    dwReturn["EKKABRKZ5"] = " ";
                    dwReturn["EKKZUARTF"] = "   ";
                    dwReturn["EKKZUABPRF"] = "0";
                    dwReturn["EKKZUABWEF"] = "0";
                    dwReturn["EKKMEEHF"] = "   ";
                    dwReturn["EKKABRKZF"] = " ";
                    dwReturn["EKKZUARTV"] = "   ";
                    dwReturn["EKKZUABPRV"] = "0";
                    dwReturn["EKKZUABWEV"] = "0";
                    dwReturn["EKKMEEHV"] = "   ";
                    dwReturn["EKKABRKZV"] = " ";
                    dwReturn["EKKVERSICH"] = "0";
                    dwReturn["EKKEDIKZ"] = " ";
                    dwReturn["EKKKOMMNR"] = "                    ";
                    dwReturn["EKKEDIDAT"] = "0";
                    dwReturn["EKKEDIZEIT"] = "0";
                    dwReturn["EKKABSAUFART"] = "  ";
                    dwReturn["EKKFILLER"] = "  N00000000                    ";

                    #endregion
                    break;
            }
            INTEXDBC.MapData(true, ref dwReturn, dwInput);
        }
        public void MapEKKOPF(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }


        public void SaveEKKOPF(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            DataSet setResult = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            setResult = QueryEKKOPF(dwData, 1);
            if (setResult.Tables.Count > 0)
            {
                tbLocal = setResult.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }
            MapEKKOPF(ref dwLocal, dwData);

            if (!flgExist)
            {
                InsertEKKOPF(dwLocal);
            }
            UpdateEKKOPF(dwLocal);
        }
        public void InsertEKKOPF(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            dwData["EKKNEUB"] = app.User;
            dwData["EKKNEUD"] = date;
            dwData["EKKSACHB"] = app.User;
            or1 = OracleDB.CreateCommand();
            switch (app.company)
            {
                case "YCA":
                    or1.CommandText = "INSERT INTO EKKOPF(EKKMANDANT, EKKAUFKRS, EKKAUFLFD, EKKAENZL, EKKAENB, EKKAEND, EKKNEUB, EKKNEUD, EKKAUFGRP, EKKAUFART, EKKARTGR, EKKZEICH, EKKAKKRED, EKKSACHB, EKKRSTBEZ, EKKLIEFKOMP, EKKLIEFNR, EKKBADR, EKKLADR, EKKRADR, EKKKONDSL, EKKWAEHRSL, EKKPREISLST, EKKKNTRNRL, EKKKOKRS, EKKKOLFD, EKKBDAT, EKKDATV, EKKDATB, EKKANLFRLNR, EKKADRZU, EKKLO, EKKLB, EKKLP, EKKLIZENZME, EKKVERBRME, EKKME1, EKKME2, EKKME3, EKKME4, EKKME5, EKKME6, EKKME7, EKKME8, EKKME9, EKKME10, EKKWE1, EKKWE2, EKKWE3, EKKWE4, EKKWE5, EKKWE6, EKKWE7, EKKWE8, EKKWE9, EKKWE10, EKKGESSTA, EKKEINSTA, EKKBUCHKRS, EKKABLADEST, EKKATEXTSL, EKKSTKZAEHL, EKKRABART1, EKKRABPROZ1, EKKRABART2, EKKRABPROZ2, EKKRABART3, EKKRABPROZ3, EKKRABART4, EKKRABPROZ4, EKKRABART5, EKKRABPROZ5, EKKZUAB1, EKKZUABPR1, EKKZUABWE1, EKKZUABME1, EKKABRKZ1, EKKZUAB2, EKKZUABPR2, EKKZUABWE2, EKKZUABME2, EKKABRKZ2, EKKZUAB3, EKKZUABPR3, EKKZUABWE3, EKKZUABME3, EKKABRKZ3, EKKZUAB4, EKKZUABPR4, EKKZUABWE4, EKKZUABME4, EKKABRKZ4, EKKZUAB5, EKKZUABPR5, EKKZUABWE5, EKKZUABME5, EKKABRKZ5, EKKZUARTF, EKKZUABPRF, EKKZUABWEF, EKKMEEHF, EKKABRKZF, EKKZUARTV, EKKZUABPRV, EKKZUABWEV, EKKMEEHV, EKKABRKZV, EKKVERSICH, EKKEDIKZ, EKKKOMMNR, EKKEDIDAT, EKKEDIZEIT, EKKABSAUFART, EKKFILLER)"
                + " VALUES (:EKKMANDANT,:EKKAUFKRS, :EKKAUFLFD, 4, 'JANE    ', 20081126, 'JANE    ', 20081126, 'B', 'BE', '8', '              ', '               ', 'JANE    ', '      ', 'N', '00009003', ' ', ' ', ' ', 'STD ', 'RMB', '     ', '               ', '  ', '      ', 20081111, 0, 0, '        ', '    ', '01', '  ', '        ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5464000, 0, 0, 0, 0, 0, 0, 0, 0, 0, '  ', '  ', '   ', '    ', '   ', '0000', '   ', 0, '   ', 0, '   ', 0, '   ', 0, '   ', 0, '   ', 0, 0, '   ', ' ', '   ', 0, 0, '   ', ' ', '   ', 0, 0, '   ', ' ', '   ', 0, 0, '   ', ' ', '   ', 0, 0, '   ', ' ', '   ', 0, 0, '   ', ' ', '   ', 0, 0, '   ', ' ', 0, ' ', '                    ', 0, 0, '  ', '                               ')";
                    or1.Parameters.Add("EKKMANDANT", OracleType.NVarChar).Value = dwData["EKKMANDANT"].ToString();
                    or1.Parameters.Add("EKKAUFKRS", OracleType.NVarChar).Value = dwData["EKKAUFKRS"].ToString();
                    or1.Parameters.Add("EKKAUFLFD", OracleType.NVarChar).Value = dwData["EKKAUFLFD"].ToString();
                    break;
                default:
                    or1.CommandText = "INSERT INTO EKKOPF ( EKKMANDANT,EKKAUFKRS,EKKAUFLFD,EKKAENZL,EKKAENB,EKKAEND,EKKNEUB,EKKNEUD,EKKAUFGRP,EKKAUFART,EKKARTGR,EKKZEICH,EKKAKKRED,EKKSACHB,EKKRSTBEZ,EKKLIEFKOMP,EKKLIEFNR,EKKBADR,EKKLADR,EKKRADR,EKKKONDSL,EKKWAEHRSL,EKKPREISLST,EKKKNTRNRL,EKKKOKRS,EKKKOLFD,EKKBDAT,EKKDATV,EKKDATB,EKKANLFRLNR,EKKADRZU,EKKLO,EKKLB,EKKLP,EKKLIZENZME,EKKVERBRME,EKKME1,EKKME2,EKKME3,EKKME4,EKKME5,EKKME6,EKKME7,EKKME8,EKKME9,EKKME10,EKKWE1,EKKWE2,EKKWE3,EKKWE4,EKKWE5,EKKWE6,EKKWE7,EKKWE8,EKKWE9,EKKWE10,EKKGESSTA,EKKEINSTA,EKKBUCHKRS,EKKABLADEST,EKKATEXTSL,EKKSTKZAEHL,EKKRABART1,EKKRABPROZ1,EKKRABART2,EKKRABPROZ2,EKKRABART3,EKKRABPROZ3,EKKRABART4,EKKRABPROZ4,EKKRABART5,EKKRABPROZ5,EKKZUAB1,EKKZUABPR1,EKKZUABWE1,EKKZUABME1,EKKABRKZ1,EKKZUAB2,EKKZUABPR2,EKKZUABWE2,EKKZUABME2,EKKABRKZ2,EKKZUAB3,EKKZUABPR3,EKKZUABWE3,EKKZUABME3,EKKABRKZ3,EKKZUAB4,EKKZUABPR4,EKKZUABWE4,EKKZUABME4,EKKABRKZ4,EKKZUAB5,EKKZUABPR5,EKKZUABWE5,EKKZUABME5,EKKABRKZ5,EKKZUARTF,EKKZUABPRF,EKKZUABWEF,EKKMEEHF,EKKABRKZF,EKKZUARTV,EKKZUABPRV,EKKZUABWEV,EKKMEEHV,EKKABRKZV,EKKVERSICH,EKKEDIKZ,EKKKOMMNR,EKKEDIDAT,EKKEDIZEIT,EKKABSAUFART,EKKFILLER)"
                    + " VALUES (:EKKMANDANT:,:EKKAUFKRS:,:EKKAUFLFD:,:EKKAENZL:,:EKKAENB:,:EKKAEND:,:EKKNEUB:,:EKKNEUD:,:EKKAUFGRP:,:EKKAUFART:,:EKKARTGR:,:EKKZEICH:,:EKKAKKRED:,:EKKSACHB:,:EKKRSTBEZ:,:EKKLIEFKOMP:,:EKKLIEFNR:,:EKKBADR:,:EKKLADR:,:EKKRADR:,:EKKKONDSL:,:EKKWAEHRSL:,:EKKPREISLST:,:EKKKNTRNRL:,:EKKKOKRS:,:EKKKOLFD:,:EKKBDAT:,:EKKDATV:,:EKKDATB:,:EKKANLFRLNR:,:EKKADRZU:,:EKKLO:,:EKKLB:,:EKKLP:,:EKKLIZENZME:,:EKKVERBRME:,:EKKME1:,:EKKME2:,:EKKME3:,:EKKME4:,:EKKME5:,:EKKME6:,:EKKME7:,:EKKME8:,:EKKME9:,:EKKME10:,:EKKWE1:,:EKKWE2:,:EKKWE3:,:EKKWE4:,:EKKWE5:,:EKKWE6:,:EKKWE7:,:EKKWE8:,:EKKWE9:,:EKKWE10:,:EKKGESSTA:,:EKKEINSTA:,:EKKBUCHKRS:,:EKKABLADEST:,:EKKATEXTSL:,:EKKSTKZAEHL:,:EKKRABART1:,:EKKRABPROZ1:,:EKKRABART2:,:EKKRABPROZ2:,:EKKRABART3:,:EKKRABPROZ3:,:EKKRABART4:,:EKKRABPROZ4:,:EKKRABART5:,:EKKRABPROZ5:,:EKKZUAB1:,:EKKZUABPR1:,:EKKZUABWE1:,:EKKZUABME1:,:EKKABRKZ1:,:EKKZUAB2:,:EKKZUABPR2:,:EKKZUABWE2:,:EKKZUABME2:,:EKKABRKZ2:,:EKKZUAB3:,:EKKZUABPR3:,:EKKZUABWE3:,:EKKZUABME3:,:EKKABRKZ3:,:EKKZUAB4:,:EKKZUABPR4:,:EKKZUABWE4:,:EKKZUABME4:,:EKKABRKZ4:,:EKKZUAB5:,:EKKZUABPR5:,:EKKZUABWE5:,:EKKZUABME5:,:EKKABRKZ5:,:EKKZUARTF:,:EKKZUABPRF:,:EKKZUABWEF:,:EKKMEEHF:,:EKKABRKZF:,:EKKZUARTV:,:EKKZUABPRV:,:EKKZUABWEV:,:EKKMEEHV:,:EKKABRKZV:,:EKKVERSICH:,:EKKEDIKZ:,:EKKKOMMNR:,:EKKEDIDAT:,:EKKEDIZEIT:,:EKKABSAUFART:,:EKKFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }

            Connect2Proxy(or1);
        }
        public void DeleteEKKOPF(string client, string krs, string lfd)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE EKKOPF "
            + " WHERE EKKMANDANT=:EKKMANDANT   AND EKKAUFKRS=:EKKAUFKRS  AND EKKAUFLFD=:EKKAUFLFD";
            or1.Parameters.Add("EKKMANDANT", OracleType.NVarChar).Value = client;
            or1.Parameters.Add("EKKAUFKRS", OracleType.NVarChar).Value = krs;
            or1.Parameters.Add("EKKAUFLFD", OracleType.NVarChar).Value = lfd;
            Connect2Proxy(or1);
        }
        public void DeleteEKKOPF(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "DELETE FROM EKKOPF  "
                        + " WHERE EKKMANDANT=:EKKMANDANT:  AND EKKAUFKRS=:EKKAUFKRS:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 1:
                    or1.CommandText = "DELETE FROM EKKOPF  "
                        + " WHERE EKKMANDANT=:EKKMANDANT:  AND EKKAUFKRS=:EKKAUFKRS:  AND EKKAUFLFD=:EKKAUFLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            Connect2Proxy(or1);
        }
       
        public void UpdateEKKOPF(DataRow dwData, int option = 1, string ITXDBVERSION = "50.24")
        {
            if (option == 0)
            {
                switch (app.company)
                {
                    default:
                    case "TST":
                    case "YGR":
                        option = 4;
                        break;
                    case "YCA":
                        option = 1;
                        break;
                }
            }
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    #region===================
                    or1.CommandText = "UPDATE EKKOPF SET "
                        + "EKKMANDANT=:EKKMANDANT,"
                        + "EKKAUFKRS=:EKKAUFKRS,"
                        + "EKKAUFLFD=:EKKAUFLFD,"
                        + "EKKAENZL=:EKKAENZL,"
                        + "EKKAENB=:EKKAENB,"
                        + "EKKAEND=:EKKAEND,"
                        + "EKKNEUB=:EKKNEUB,"
                        + "EKKNEUD=:EKKNEUD,"
                        + "EKKAUFGRP=:EKKAUFGRP,"
                        + "EKKAUFART=:EKKAUFART,"
                        + "EKKARTGR=:EKKARTGR,"
                        + "EKKZEICH=:EKKZEICH,"
                        + "EKKAKKRED=:EKKAKKRED,"
                        + "EKKSACHB=:EKKSACHB,"
                        + "EKKRSTBEZ=:EKKRSTBEZ,"
                        + "EKKLIEFKOMP=:EKKLIEFKOMP,"
                        + "EKKLIEFNR=:EKKLIEFNR,"
                        + "EKKBADR=:EKKBADR,"
                        + "EKKLADR=:EKKLADR,"
                        + "EKKRADR=:EKKRADR,"
                        + "EKKKONDSL=:EKKKONDSL,"
                        + "EKKWAEHRSL=:EKKWAEHRSL,"
                        + "EKKPREISLST=:EKKPREISLST,"
                        + "EKKKNTRNRL=:EKKKNTRNRL,"
                        + "EKKKOKRS=:EKKKOKRS,"
                        + "EKKKOLFD=:EKKKOLFD,"
                        + "EKKBDAT=:EKKBDAT,"
                        + "EKKDATV=:EKKDATV,"
                        + "EKKDATB=:EKKDATB,"
                        + "EKKANLFRLNR=:EKKANLFRLNR,"
                        + "EKKADRZU=:EKKADRZU,"
                        + "EKKLO=:EKKLO,"
                        + "EKKLB=:EKKLB,"
                        + "EKKLP=:EKKLP,"
                        + "EKKLIZENZME=:EKKLIZENZME,"
                        + "EKKVERBRME=:EKKVERBRME,"
                        + "EKKME1=:EKKME1,"
                        + "EKKME2=:EKKME2,"
                        + "EKKME3=:EKKME3,"
                        + "EKKME4=:EKKME4,"
                        + "EKKME5=:EKKME5,"
                        + "EKKME6=:EKKME6,"
                        + "EKKME7=:EKKME7,"
                        + "EKKME8=:EKKME8,"
                        + "EKKME9=:EKKME9,"
                        + "EKKME10=:EKKME10,"
                        + "EKKWE1=:EKKWE1,"
                        + "EKKWE2=:EKKWE2,"
                        + "EKKWE3=:EKKWE3,"
                        + "EKKWE4=:EKKWE4,"
                        + "EKKWE5=:EKKWE5,"
                        + "EKKWE6=:EKKWE6,"
                        + "EKKWE7=:EKKWE7,"
                        + "EKKWE8=:EKKWE8,"
                        + "EKKWE9=:EKKWE9,"
                        + "EKKWE10=:EKKWE10,"
                        + "EKKGESSTA=:EKKGESSTA,"
                        + "EKKEINSTA=:EKKEINSTA,"
                        + "EKKBUCHKRS=:EKKBUCHKRS,"
                        + "EKKABLADEST=:EKKABLADEST,"
                        + "EKKATEXTSL=:EKKATEXTSL,"
                        + "EKKSTKZAEHL=:EKKSTKZAEHL,"
                        + "EKKRABART1=:EKKRABART1,"
                        + "EKKRABPROZ1=:EKKRABPROZ1,"
                        + "EKKRABART2=:EKKRABART2,"
                        + "EKKRABPROZ2=:EKKRABPROZ2,"
                        + "EKKRABART3=:EKKRABART3,"
                        + "EKKRABPROZ3=:EKKRABPROZ3,"
                        + "EKKRABART4=:EKKRABART4,"
                        + "EKKRABPROZ4=:EKKRABPROZ4,"
                        + "EKKRABART5=:EKKRABART5,"
                        + "EKKRABPROZ5=:EKKRABPROZ5,"
                        + "EKKZUAB1=:EKKZUAB1,"
                        + "EKKZUABPR1=:EKKZUABPR1,"
                        + "EKKZUABWE1=:EKKZUABWE1,"
                        + "EKKZUABME1=:EKKZUABME1,"
                        + "EKKABRKZ1=:EKKABRKZ1,"
                        + "EKKZUAB2=:EKKZUAB2,"
                        + "EKKZUABPR2=:EKKZUABPR2,"
                        + "EKKZUABWE2=:EKKZUABWE2,"
                        + "EKKZUABME2=:EKKZUABME2,"
                        + "EKKABRKZ2=:EKKABRKZ2,"
                        + "EKKZUAB3=:EKKZUAB3,"
                        + "EKKZUABPR3=:EKKZUABPR3,"
                        + "EKKZUABWE3=:EKKZUABWE3,"
                        + "EKKZUABME3=:EKKZUABME3,"
                        + "EKKABRKZ3=:EKKABRKZ3,"
                        + "EKKZUAB4=:EKKZUAB4,"
                        + "EKKZUABPR4=:EKKZUABPR4,"
                        + "EKKZUABWE4=:EKKZUABWE4,"
                        + "EKKZUABME4=:EKKZUABME4,"
                        + "EKKABRKZ4=:EKKABRKZ4,"
                        + "EKKZUAB5=:EKKZUAB5,"
                        + "EKKZUABPR5=:EKKZUABPR5,"
                        + "EKKZUABWE5=:EKKZUABWE5,"
                        + "EKKZUABME5=:EKKZUABME5,"
                        + "EKKABRKZ5=:EKKABRKZ5,"
                        + "EKKZUARTF=:EKKZUARTF,"
                        + "EKKZUABPRF=:EKKZUABPRF,"
                        + "EKKZUABWEF=:EKKZUABWEF,"
                        + "EKKMEEHF=:EKKMEEHF,"
                        + "EKKABRKZF=:EKKABRKZF,"
                        + "EKKZUARTV=:EKKZUARTV,"
                        + "EKKZUABPRV=:EKKZUABPRV,"
                        + "EKKZUABWEV=:EKKZUABWEV,"
                        + "EKKMEEHV=:EKKMEEHV,"
                        + "EKKABRKZV=:EKKABRKZV,"
                        + "EKKVERSICH=:EKKVERSICH,"
                        + "EKKEDIKZ=:EKKEDIKZ,"
                        + "EKKKOMMNR=:EKKKOMMNR,"
                        + "EKKEDIDAT=:EKKEDIDAT,"
                        + "EKKEDIZEIT=:EKKEDIZEIT,"
                        + "EKKABSAUFART=:EKKABSAUFART,"
                        + "EKKFILLER=:EKKFILLER "
                        + " WHERE  "
                        + "  EKKMANDANT=:EKKMANDANT AND EKKAUFKRS=:EKKAUFKRS AND EKKAUFLFD=:EKKAUFLFD ";

                    or1.Parameters.Add("EKKMANDANT", OracleType.NVarChar).Value = dwData["EKKMANDANT"].ToString();
                    or1.Parameters.Add("EKKAUFKRS", OracleType.NVarChar).Value = dwData["EKKAUFKRS"].ToString();
                    or1.Parameters.Add("EKKAUFLFD", OracleType.NVarChar).Value = dwData["EKKAUFLFD"].ToString();
                    or1.Parameters.Add("EKKAENZL", OracleType.NVarChar).Value = dwData["EKKAENZL"].ToString();
                    or1.Parameters.Add("EKKAENB", OracleType.NVarChar).Value = dwData["EKKAENB"].ToString();
                    or1.Parameters.Add("EKKAEND", OracleType.NVarChar).Value = dwData["EKKAEND"].ToString();
                    or1.Parameters.Add("EKKNEUB", OracleType.NVarChar).Value = dwData["EKKNEUB"].ToString();
                    or1.Parameters.Add("EKKNEUD", OracleType.NVarChar).Value = dwData["EKKNEUD"].ToString();
                    or1.Parameters.Add("EKKAUFGRP", OracleType.NVarChar).Value = dwData["EKKAUFGRP"].ToString();
                    or1.Parameters.Add("EKKAUFART", OracleType.NVarChar).Value = dwData["EKKAUFART"].ToString();
                    or1.Parameters.Add("EKKARTGR", OracleType.NVarChar).Value = dwData["EKKARTGR"].ToString();
                    or1.Parameters.Add("EKKZEICH", OracleType.NVarChar).Value = dwData["EKKZEICH"].ToString();
                    or1.Parameters.Add("EKKAKKRED", OracleType.NVarChar).Value = dwData["EKKAKKRED"].ToString();
                    or1.Parameters.Add("EKKSACHB", OracleType.NVarChar).Value = dwData["EKKSACHB"].ToString();
                    or1.Parameters.Add("EKKRSTBEZ", OracleType.NVarChar).Value = dwData["EKKRSTBEZ"].ToString();
                    or1.Parameters.Add("EKKLIEFKOMP", OracleType.NVarChar).Value = dwData["EKKLIEFKOMP"].ToString();
                    or1.Parameters.Add("EKKLIEFNR", OracleType.NVarChar).Value = dwData["EKKLIEFNR"].ToString();
                    or1.Parameters.Add("EKKBADR", OracleType.NVarChar).Value = dwData["EKKBADR"].ToString();
                    or1.Parameters.Add("EKKLADR", OracleType.NVarChar).Value = dwData["EKKLADR"].ToString();
                    or1.Parameters.Add("EKKRADR", OracleType.NVarChar).Value = dwData["EKKRADR"].ToString();
                    or1.Parameters.Add("EKKKONDSL", OracleType.NVarChar).Value = dwData["EKKKONDSL"].ToString();
                    or1.Parameters.Add("EKKWAEHRSL", OracleType.NVarChar).Value = dwData["EKKWAEHRSL"].ToString();
                    or1.Parameters.Add("EKKPREISLST", OracleType.NVarChar).Value = dwData["EKKPREISLST"].ToString();
                    or1.Parameters.Add("EKKKNTRNRL", OracleType.NVarChar).Value = dwData["EKKKNTRNRL"].ToString();
                    or1.Parameters.Add("EKKKOKRS", OracleType.NVarChar).Value = dwData["EKKKOKRS"].ToString();
                    or1.Parameters.Add("EKKKOLFD", OracleType.NVarChar).Value = dwData["EKKKOLFD"].ToString();
                    or1.Parameters.Add("EKKBDAT", OracleType.NVarChar).Value = dwData["EKKBDAT"].ToString();
                    or1.Parameters.Add("EKKDATV", OracleType.NVarChar).Value = dwData["EKKDATV"].ToString();
                    or1.Parameters.Add("EKKDATB", OracleType.NVarChar).Value = dwData["EKKDATB"].ToString();
                    or1.Parameters.Add("EKKANLFRLNR", OracleType.NVarChar).Value = dwData["EKKANLFRLNR"].ToString();
                    or1.Parameters.Add("EKKADRZU", OracleType.NVarChar).Value = dwData["EKKADRZU"].ToString();
                    or1.Parameters.Add("EKKLO", OracleType.NVarChar).Value = dwData["EKKLO"].ToString();
                    or1.Parameters.Add("EKKLB", OracleType.NVarChar).Value = dwData["EKKLB"].ToString();
                    or1.Parameters.Add("EKKLP", OracleType.NVarChar).Value = dwData["EKKLP"].ToString();
                    or1.Parameters.Add("EKKLIZENZME", OracleType.NVarChar).Value = dwData["EKKLIZENZME"].ToString();
                    or1.Parameters.Add("EKKVERBRME", OracleType.NVarChar).Value = dwData["EKKVERBRME"].ToString();
                    or1.Parameters.Add("EKKME1", OracleType.NVarChar).Value = dwData["EKKME1"].ToString();
                    or1.Parameters.Add("EKKME2", OracleType.NVarChar).Value = dwData["EKKME2"].ToString();
                    or1.Parameters.Add("EKKME3", OracleType.NVarChar).Value = dwData["EKKME3"].ToString();
                    or1.Parameters.Add("EKKME4", OracleType.NVarChar).Value = dwData["EKKME4"].ToString();
                    or1.Parameters.Add("EKKME5", OracleType.NVarChar).Value = dwData["EKKME5"].ToString();
                    or1.Parameters.Add("EKKME6", OracleType.NVarChar).Value = dwData["EKKME6"].ToString();
                    or1.Parameters.Add("EKKME7", OracleType.NVarChar).Value = dwData["EKKME7"].ToString();
                    or1.Parameters.Add("EKKME8", OracleType.NVarChar).Value = dwData["EKKME8"].ToString();
                    or1.Parameters.Add("EKKME9", OracleType.NVarChar).Value = dwData["EKKME9"].ToString();
                    or1.Parameters.Add("EKKME10", OracleType.NVarChar).Value = dwData["EKKME10"].ToString();
                    or1.Parameters.Add("EKKWE1", OracleType.NVarChar).Value = dwData["EKKWE1"].ToString();
                    or1.Parameters.Add("EKKWE2", OracleType.NVarChar).Value = dwData["EKKWE2"].ToString();
                    or1.Parameters.Add("EKKWE3", OracleType.NVarChar).Value = dwData["EKKWE3"].ToString();
                    or1.Parameters.Add("EKKWE4", OracleType.NVarChar).Value = dwData["EKKWE4"].ToString();
                    or1.Parameters.Add("EKKWE5", OracleType.NVarChar).Value = dwData["EKKWE5"].ToString();
                    or1.Parameters.Add("EKKWE6", OracleType.NVarChar).Value = dwData["EKKWE6"].ToString();
                    or1.Parameters.Add("EKKWE7", OracleType.NVarChar).Value = dwData["EKKWE7"].ToString();
                    or1.Parameters.Add("EKKWE8", OracleType.NVarChar).Value = dwData["EKKWE8"].ToString();
                    or1.Parameters.Add("EKKWE9", OracleType.NVarChar).Value = dwData["EKKWE9"].ToString();
                    or1.Parameters.Add("EKKWE10", OracleType.NVarChar).Value = dwData["EKKWE10"].ToString();
                    or1.Parameters.Add("EKKGESSTA", OracleType.NVarChar).Value = dwData["EKKGESSTA"].ToString();
                    or1.Parameters.Add("EKKEINSTA", OracleType.NVarChar).Value = dwData["EKKEINSTA"].ToString();
                    or1.Parameters.Add("EKKBUCHKRS", OracleType.NVarChar).Value = dwData["EKKBUCHKRS"].ToString();
                    or1.Parameters.Add("EKKABLADEST", OracleType.NVarChar).Value = dwData["EKKABLADEST"].ToString();
                    or1.Parameters.Add("EKKATEXTSL", OracleType.NVarChar).Value = dwData["EKKATEXTSL"].ToString();
                    or1.Parameters.Add("EKKSTKZAEHL", OracleType.NVarChar).Value = dwData["EKKSTKZAEHL"].ToString();
                    or1.Parameters.Add("EKKRABART1", OracleType.NVarChar).Value = dwData["EKKRABART1"].ToString();
                    or1.Parameters.Add("EKKRABPROZ1", OracleType.NVarChar).Value = dwData["EKKRABPROZ1"].ToString();
                    or1.Parameters.Add("EKKRABART2", OracleType.NVarChar).Value = dwData["EKKRABART2"].ToString();
                    or1.Parameters.Add("EKKRABPROZ2", OracleType.NVarChar).Value = dwData["EKKRABPROZ2"].ToString();
                    or1.Parameters.Add("EKKRABART3", OracleType.NVarChar).Value = dwData["EKKRABART3"].ToString();
                    or1.Parameters.Add("EKKRABPROZ3", OracleType.NVarChar).Value = dwData["EKKRABPROZ3"].ToString();
                    or1.Parameters.Add("EKKRABART4", OracleType.NVarChar).Value = dwData["EKKRABART4"].ToString();
                    or1.Parameters.Add("EKKRABPROZ4", OracleType.NVarChar).Value = dwData["EKKRABPROZ4"].ToString();
                    or1.Parameters.Add("EKKRABART5", OracleType.NVarChar).Value = dwData["EKKRABART5"].ToString();
                    or1.Parameters.Add("EKKRABPROZ5", OracleType.NVarChar).Value = dwData["EKKRABPROZ5"].ToString();
                    or1.Parameters.Add("EKKZUAB1", OracleType.NVarChar).Value = dwData["EKKZUAB1"].ToString();
                    or1.Parameters.Add("EKKZUABPR1", OracleType.NVarChar).Value = dwData["EKKZUABPR1"].ToString();
                    or1.Parameters.Add("EKKZUABWE1", OracleType.NVarChar).Value = dwData["EKKZUABWE1"].ToString();
                    or1.Parameters.Add("EKKZUABME1", OracleType.NVarChar).Value = dwData["EKKZUABME1"].ToString();
                    or1.Parameters.Add("EKKABRKZ1", OracleType.NVarChar).Value = dwData["EKKABRKZ1"].ToString();
                    or1.Parameters.Add("EKKZUAB2", OracleType.NVarChar).Value = dwData["EKKZUAB2"].ToString();
                    or1.Parameters.Add("EKKZUABPR2", OracleType.NVarChar).Value = dwData["EKKZUABPR2"].ToString();
                    or1.Parameters.Add("EKKZUABWE2", OracleType.NVarChar).Value = dwData["EKKZUABWE2"].ToString();
                    or1.Parameters.Add("EKKZUABME2", OracleType.NVarChar).Value = dwData["EKKZUABME2"].ToString();
                    or1.Parameters.Add("EKKABRKZ2", OracleType.NVarChar).Value = dwData["EKKABRKZ2"].ToString();
                    or1.Parameters.Add("EKKZUAB3", OracleType.NVarChar).Value = dwData["EKKZUAB3"].ToString();
                    or1.Parameters.Add("EKKZUABPR3", OracleType.NVarChar).Value = dwData["EKKZUABPR3"].ToString();
                    or1.Parameters.Add("EKKZUABWE3", OracleType.NVarChar).Value = dwData["EKKZUABWE3"].ToString();
                    or1.Parameters.Add("EKKZUABME3", OracleType.NVarChar).Value = dwData["EKKZUABME3"].ToString();
                    or1.Parameters.Add("EKKABRKZ3", OracleType.NVarChar).Value = dwData["EKKABRKZ3"].ToString();
                    or1.Parameters.Add("EKKZUAB4", OracleType.NVarChar).Value = dwData["EKKZUAB4"].ToString();
                    or1.Parameters.Add("EKKZUABPR4", OracleType.NVarChar).Value = dwData["EKKZUABPR4"].ToString();
                    or1.Parameters.Add("EKKZUABWE4", OracleType.NVarChar).Value = dwData["EKKZUABWE4"].ToString();
                    or1.Parameters.Add("EKKZUABME4", OracleType.NVarChar).Value = dwData["EKKZUABME4"].ToString();
                    or1.Parameters.Add("EKKABRKZ4", OracleType.NVarChar).Value = dwData["EKKABRKZ4"].ToString();
                    or1.Parameters.Add("EKKZUAB5", OracleType.NVarChar).Value = dwData["EKKZUAB5"].ToString();
                    or1.Parameters.Add("EKKZUABPR5", OracleType.NVarChar).Value = dwData["EKKZUABPR5"].ToString();
                    or1.Parameters.Add("EKKZUABWE5", OracleType.NVarChar).Value = dwData["EKKZUABWE5"].ToString();
                    or1.Parameters.Add("EKKZUABME5", OracleType.NVarChar).Value = dwData["EKKZUABME5"].ToString();
                    or1.Parameters.Add("EKKABRKZ5", OracleType.NVarChar).Value = dwData["EKKABRKZ5"].ToString();
                    or1.Parameters.Add("EKKZUARTF", OracleType.NVarChar).Value = dwData["EKKZUARTF"].ToString();
                    or1.Parameters.Add("EKKZUABPRF", OracleType.NVarChar).Value = dwData["EKKZUABPRF"].ToString();
                    or1.Parameters.Add("EKKZUABWEF", OracleType.NVarChar).Value = dwData["EKKZUABWEF"].ToString();
                    or1.Parameters.Add("EKKMEEHF", OracleType.NVarChar).Value = dwData["EKKMEEHF"].ToString();
                    or1.Parameters.Add("EKKABRKZF", OracleType.NVarChar).Value = dwData["EKKABRKZF"].ToString();
                    or1.Parameters.Add("EKKZUARTV", OracleType.NVarChar).Value = dwData["EKKZUARTV"].ToString();
                    or1.Parameters.Add("EKKZUABPRV", OracleType.NVarChar).Value = dwData["EKKZUABPRV"].ToString();
                    or1.Parameters.Add("EKKZUABWEV", OracleType.NVarChar).Value = dwData["EKKZUABWEV"].ToString();
                    or1.Parameters.Add("EKKMEEHV", OracleType.NVarChar).Value = dwData["EKKMEEHV"].ToString();
                    or1.Parameters.Add("EKKABRKZV", OracleType.NVarChar).Value = dwData["EKKABRKZV"].ToString();
                    or1.Parameters.Add("EKKVERSICH", OracleType.NVarChar).Value = dwData["EKKVERSICH"].ToString();
                    or1.Parameters.Add("EKKEDIKZ", OracleType.NVarChar).Value = dwData["EKKEDIKZ"].ToString();
                    or1.Parameters.Add("EKKKOMMNR", OracleType.NVarChar).Value = dwData["EKKKOMMNR"].ToString();
                    or1.Parameters.Add("EKKEDIDAT", OracleType.NVarChar).Value = dwData["EKKEDIDAT"].ToString();
                    or1.Parameters.Add("EKKEDIZEIT", OracleType.NVarChar).Value = dwData["EKKEDIZEIT"].ToString();
                    or1.Parameters.Add("EKKABSAUFART", OracleType.NVarChar).Value = dwData["EKKABSAUFART"].ToString();
                    or1.Parameters.Add("EKKFILLER", OracleType.NVarChar).Value = dwData["EKKFILLER"].ToString();
                    #endregion
                    break;
                case 2:
                    UEKK02(dwData);

                    break;
                case 3:
                    or1.CommandText = "UPDATE EKPOS SET EKPLIEFNR=:EKKLIEFNR: "
                 + " WHERE EKPMANDANT=:EKKMANDANT: AND EKPAUFKRS=:EKKAUFKRS: AND EKPAUFLFD=:EKKAUFLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    or1.CommandText = "UPDATE EKKOPF SET EKKLIEFNR=:EKKLIEFNR: "
                    + " WHERE EKKMANDANT=:EKKMANDANT: AND EKKAUFKRS=:EKKAUFKRS: AND EKKAUFLFD=:EKKAUFLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 21:
                    UEKK21(dwData);
                    break;
                case 4:
                    or1.CommandText = "UPDATE EKKOPF SET EKKMANDANT=:EKKMANDANT:,EKKAUFKRS=:EKKAUFKRS:,EKKAUFLFD=:EKKAUFLFD:,EKKAENZL=:EKKAENZL:,EKKAENB=:EKKAENB:,EKKAEND=:EKKAEND:,EKKNEUB=:EKKNEUB:,EKKNEUD=:EKKNEUD:,EKKAUFGRP=:EKKAUFGRP:,EKKAUFART=:EKKAUFART:,EKKARTGR=:EKKARTGR:,EKKZEICH=:EKKZEICH:,EKKAKKRED=:EKKAKKRED:,EKKSACHB=:EKKSACHB:,EKKRSTBEZ=:EKKRSTBEZ:,EKKLIEFKOMP=:EKKLIEFKOMP:,EKKLIEFNR=:EKKLIEFNR:,EKKBADR=:EKKBADR:,EKKLADR=:EKKLADR:,EKKRADR=:EKKRADR:,EKKKONDSL=:EKKKONDSL:,EKKWAEHRSL=:EKKWAEHRSL:,EKKPREISLST=:EKKPREISLST:,EKKKNTRNRL=:EKKKNTRNRL:,EKKKOKRS=:EKKKOKRS:,EKKKOLFD=:EKKKOLFD:,EKKBDAT=:EKKBDAT:,EKKDATV=:EKKDATV:,EKKDATB=:EKKDATB:,EKKANLFRLNR=:EKKANLFRLNR:,EKKADRZU=:EKKADRZU:,EKKLO=:EKKLO:,EKKLB=:EKKLB:,EKKLP=:EKKLP:,EKKLIZENZME=:EKKLIZENZME:,EKKVERBRME=:EKKVERBRME:,EKKME1=:EKKME1:,EKKME2=:EKKME2:,EKKME3=:EKKME3:,EKKME4=:EKKME4:,EKKME5=:EKKME5:,EKKME6=:EKKME6:,EKKME7=:EKKME7:,EKKME8=:EKKME8:,EKKME9=:EKKME9:,EKKME10=:EKKME10:,EKKWE1=:EKKWE1:,EKKWE2=:EKKWE2:,EKKWE3=:EKKWE3:,EKKWE4=:EKKWE4:,EKKWE5=:EKKWE5:,EKKWE6=:EKKWE6:,EKKWE7=:EKKWE7:,EKKWE8=:EKKWE8:,EKKWE9=:EKKWE9:,EKKWE10=:EKKWE10:,EKKGESSTA=:EKKGESSTA:,EKKEINSTA=:EKKEINSTA:,EKKBUCHKRS=:EKKBUCHKRS:,EKKABLADEST=:EKKABLADEST:,EKKATEXTSL=:EKKATEXTSL:,EKKSTKZAEHL=:EKKSTKZAEHL:,EKKRABART1=:EKKRABART1:,EKKRABPROZ1=:EKKRABPROZ1:,EKKRABART2=:EKKRABART2:,EKKRABPROZ2=:EKKRABPROZ2:,EKKRABART3=:EKKRABART3:,EKKRABPROZ3=:EKKRABPROZ3:,EKKRABART4=:EKKRABART4:,EKKRABPROZ4=:EKKRABPROZ4:,EKKRABART5=:EKKRABART5:,EKKRABPROZ5=:EKKRABPROZ5:,EKKZUAB1=:EKKZUAB1:,EKKZUABPR1=:EKKZUABPR1:,EKKZUABWE1=:EKKZUABWE1:,EKKZUABME1=:EKKZUABME1:,EKKABRKZ1=:EKKABRKZ1:,EKKZUAB2=:EKKZUAB2:,EKKZUABPR2=:EKKZUABPR2:,EKKZUABWE2=:EKKZUABWE2:,EKKZUABME2=:EKKZUABME2:,EKKABRKZ2=:EKKABRKZ2:,EKKZUAB3=:EKKZUAB3:,EKKZUABPR3=:EKKZUABPR3:,EKKZUABWE3=:EKKZUABWE3:,EKKZUABME3=:EKKZUABME3:,EKKABRKZ3=:EKKABRKZ3:,EKKZUAB4=:EKKZUAB4:,EKKZUABPR4=:EKKZUABPR4:,EKKZUABWE4=:EKKZUABWE4:,EKKZUABME4=:EKKZUABME4:,EKKABRKZ4=:EKKABRKZ4:,EKKZUAB5=:EKKZUAB5:,EKKZUABPR5=:EKKZUABPR5:,EKKZUABWE5=:EKKZUABWE5:,EKKZUABME5=:EKKZUABME5:,EKKABRKZ5=:EKKABRKZ5:,EKKZUARTF=:EKKZUARTF:,EKKZUABPRF=:EKKZUABPRF:,EKKZUABWEF=:EKKZUABWEF:,EKKMEEHF=:EKKMEEHF:,EKKABRKZF=:EKKABRKZF:,EKKZUARTV=:EKKZUARTV:,EKKZUABPRV=:EKKZUABPRV:,EKKZUABWEV=:EKKZUABWEV:,EKKMEEHV=:EKKMEEHV:,EKKABRKZV=:EKKABRKZV:,EKKVERSICH=:EKKVERSICH:,EKKEDIKZ=:EKKEDIKZ:,EKKKOMMNR=:EKKKOMMNR:,EKKEDIDAT=:EKKEDIDAT:,EKKEDIZEIT=:EKKEDIZEIT:,EKKABSAUFART=:EKKABSAUFART:,EKKFILLER=:EKKFILLER:"
                                      + " WHERE EKKMANDANT=:EKKMANDANT: AND EKKAUFKRS=:EKKAUFKRS: AND EKKAUFLFD=:EKKAUFLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            Connect2Proxy(or1);
        }
        public void UEKK02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE EKKOPF SET (EKKWE1,EKKME1)=(SELECT SUM(EKPWE1),SUM(EKPME1) FROM EKPOS"
                 + " WHERE EKPSA='PO' AND EKPAUFKRS=EKKAUFKRS AND EKPAUFLFD=EKKAUFLFD  AND  EKKMANDANT=:EKKMANDANT: AND EKKAUFKRS=:EKKAUFKRS: AND EKKAUFLFD=:EKKAUFLFD: GROUP BY EKPAUFKRS,EKPAUFLFD)"
                 + " WHERE EXISTS (SELECT 1 FROM EKPOS WHERE EKPSA='PO' AND EKPAUFKRS=EKKAUFKRS AND EKPAUFLFD=EKKAUFLFD  AND  EKKMANDANT=:EKKMANDANT: AND EKKAUFKRS=:EKKAUFKRS: AND EKKAUFLFD=:EKKAUFLFD:)";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }

        public void UEKK21(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE EKKOPF SET (EKKWE1,EKKWE3)= (SELECT SUM(EKPWE1),SUM(EKPWE3) FROM EKPOS   WHERE EKPSA ='PO' AND EKPAUFKRS=EKKAUFKRS AND EKPAUFLFD = EKKAUFLFD)"
                            + " WHERE  EKKMANDANT=:EKKMANDANT: AND EKKAUFKRS = :EKKAUFKRS: AND EKKAUFLFD =:EKKAUFLFD: AND EXISTS (SELECT 1 FROM EKPOS   WHERE EKPSA ='PO' AND EKPAUFKRS=EKKAUFKRS AND EKPAUFLFD = EKKAUFLFD)";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }

        public void UEKK22(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE EKKOPF SET EKKGESSTA=:EKKGESSTA:,EKKEINSTA=:EKKEINSTA:"
                    + " WHERE  EKKMANDANT=:EKKMANDANT: AND EKKAUFKRS=:EKKAUFKRS: AND EKKAUFLFD=:EKKAUFLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }

        public DataSet QueryEKKOPF(DataRow dwData, int option = 1)
        {
           
            switch (option)
            {
                case 0:
                    SResult = QEKK00(dwData);
                    break;
                case 1:
                    SResult = QEKK01(dwData);
                    break;
                case 2:
                    SResult = QEKK02(dwData);
                    break;
                case 3:
                    SResult = QEKK03(dwData);
                    break;
                case 4:
                    SResult = QEKK04(dwData);
                    break; 
            }
          
            return SResult;
        }
        public DataSet QEKK00(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT * FROM EKKOPF WHERE  ROWNUM<2 ";

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK99(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT * FROM EKKOPF WHEREEKKMANDANT=:EKKMANDANT: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT SUBSTR(EKKKOMMNR,10,3) AS EKKZAHLBED, K.* FROM EKKOPF K  "
                + "LEFT JOIN LIEFKO ON LSKMANDANT=EKKMANDANT AND LSKLIEFNR =EKKLIEFNR AND LSKKONDSL=EKKKONDSL"
                + " WHERE EKKMANDANT=:EKKMANDANT:  AND EKKAUFKRS=:EKKAUFKRS:  AND EKKAUFLFD=:EKKAUFLFD:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT  SUBSTR(EKKKOMMNR,10,3) AS EKKZAHLBED,K.* FROM EKKOPF K WHERE EKKMANDANT=:EKKMANDANT: AND EKKLIEFNR=:EKKLIEFNR:"
                + "LEFT JOIN LIEFKO ON LSKMANDANT=EKKMANDANT AND LSKLIEFNR =EKKLIEFNR AND LSKKONDSL=EKKKONDSL"
                + dwData["EKKFILLER"].ToString();
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK03(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT  SUBSTR(EKKKOMMNR,10,3) AS EKKZAHLBED,K.* FROM EKKOPF K "
                 + "LEFT JOIN LIEFKO ON LSKMANDANT=EKKMANDANT AND LSKLIEFNR =EKKLIEFNR AND LSKKONDSL=EKKKONDSL"
            + " WHERE EKKMANDANT=:EKKMANDANT:  AND EKKAUFKRS=:EKKAUFKRS:  AND EKKAUFLFD=:EKKAUFLFD:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK04(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();


            or1.CommandText = "SELECT EKKAUFKRS,EKKAUFLFD,EKKNEUB,EKKNEUD FROM EKKOPF "
            + "LEFT JOIN LIEFKO ON LSKMANDANT=EKKMANDANT AND LSKLIEFNR =EKKLIEFNR AND LSKKONDSL=EKKKONDSL"
            + " WHERE EKKMANDANT=:EKKMANDANT: AND EKKLIEFNR=:EKKLIEFNR:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK05(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT A.EKKAUFKRS,A.EKKAUFLFD,A.EKKAUFKRS||'-'||TO_NUMBER(A.EKKAUFLFD) AS ORDNO,A.EKKLIEFNR,TRIM(C.LSLIEFNA) AS SUPP,C.LSLIEFDAT,WAFMINPMENG, "
                + " TO_CHAR(TO_DATE(A.EKKNEUD,'YYYYMMDD'),'MON-DD,YYYY') AS ORDDAT,TO_CHAR(SYSDATE,'MON-DD,YYYY') AS DAT,SUBSTR(A.EKKKOMMNR,1,3)||' '||A.EKKRSTBEZ AS DELT,SUBSTR(A.EKKKOMMNR,10,3) AS PAYMENT, "
                + " (SELECT STRAGG(T2.TXTKTEXT) FROM TXTIND T1,TXTKON T2 WHERE T1.TXTIMANDANT = T2.TXTKMANDANT AND T1.TXTIPIND = T2.TXTKPIND "
                + "  AND T1.TXTITXTART = 'ZAB' AND T1.TXTISIND LIKE SUBSTR(A.EKKKOMMNR,10,3)||'V%') AS PAYBEZ, "
                + " (select trim(substr(sddaten,2,20)) from sddat t where sdsa = '0149' and sdkey like a.Ekkmandant||A.EKKWAEHRSL||'%') as CURRENCY, "
                + " (select substr(sddaten,52,10) from sddat where sdsa = '0208' and sdkey like A.EKKMANDANT||SUBSTR(A.EKKKOMMNR,4,3)||'%V')AS TRS, "
                + " (SELECT TRIM(VBEZ) FROM VERSART V WHERE V.VMANDANT = A.EKKMANDANT AND VVERSART =SUBSTR(A.EKKKOMMNR,4,3) AND VSPED = SUBSTR(A.EKKKOMMNR,7,3) ) AS TRU, "
                + " STRAGG(DISTINCT TRIM(B.EKPTEXTKON))OVER(PARTITION BY A.EKKAUFKRS,A.EKKAUFLFD) AS TOLERANCE, "
                + " (SELECT NVL(MAX(TRIM(S.KDKUNDNA)),'') FROM ABAUFM f,VKKOPF k,KDSTAMM s "
                + " WHERE f.ABAAUFTYP ='B' AND f.ABAAUFKRS =A.EKKAUFKRS AND f.ABAAUFLFD = A.EKKAUFLFD AND f.ABAVKAUFTYP ='K' "
                + " AND f.ABAMANDANT = k.VKKMANDANT AND f.ABAVKAUFKRS = k.VKKAUFKRS AND f.ABAVKAUFLFD = k.VKKAUFLFD "
                + " AND k.VKKMANDANT = s.KDMANDANT AND k.VKKKUNDNR = s.KDKUNDNR) AS CUSTOMER, "
                + " (SELECT MAX(NVL(VKKSACHBE,'')) FROM ABAUFM f,VKKOPF k "
                + " WHERE f.ABAAUFTYP ='B' AND f.ABAAUFKRS =A.EKKAUFKRS AND f.ABAAUFLFD = A.EKKAUFLFD AND f.ABAVKAUFTYP ='K' "
                + " AND f.ABAMANDANT = k.VKKMANDANT AND f.ABAVKAUFKRS = k.VKKAUFKRS AND f.ABAVKAUFLFD = k.VKKAUFLFD) AS SACHBE, "
                + " (SELECT STRAGG(DISTINCT TRIM(T2.TXTKTEXT)) FROM TXTIND T1,TXTKON T2 WHERE T1.TXTIMANDANT = T2.TXTKMANDANT AND T1.TXTIPIND = T2.TXTKPIND "
                + " AND T1.TXTITXTART = 'EKP' AND T1.TXTISIND LIKE A.EKKAUFKRS||A.EKKAUFLFD||'%') AS REMARK, "
                + " NVL(TRIM(EKALNAME1)||TRIM(EKALNAME2),'') AS DELNAME,NVL(TRIM(EKALSTRASSE1)||TRIM(VKALSTRASSE2),'')AS DELADR, "
                + " (SELECT NVL(TRIM(K.KDANAME1)||TRIM(K.KDANAME2),'') FROM KUNDADR K WHERE E.EKAMANDANT = K.KDAMANDANT "
                + " AND E.EKALIEFNR3 = K.KDAKUNDNR AND E.EKAADRSL3 = K.KDAADRSL)AS INVNAME, "
                + " (SELECT NVL(TRIM(K.KDASTRASSE1)||TRIM(K.KDASTRASSE2),'') FROM KUNDADR K WHERE E.EKAMANDANT = K.KDAMANDANT "
                + " AND E.EKALIEFNR3 = K.KDAKUNDNR AND E.EKAADRSL3 = K.KDAADRSL)AS INVADR "
                + " FROM EKKOPF A,EKPOS B,LIEFDAT C,EKADR E " 
                + " WHERE A.EKKMANDANT = B.EKPMANDANT AND A.EKKAUFKRS = B.EKPAUFKRS "
                + " AND A.EKKAUFLFD = B.EKPAUFLFD AND B.EKPSA='PO' "
                + " AND A.EKKMANDANT = C.LSMANDANT AND A.EKKLIEFNR = C.LSLIEFNR "
                + " AND A.EKKMANDANT = E.EKAMANDANT AND A.EKKAUFKRS = E.EKAAUFKRS AND A.EKKAUFLFD = E.EKAAUFLFD AND E.EKAAUFPOS ='000' "
                + " AND A.EKKMANDANT = :EKKMANDANT: AND A.EKKAUFKRS =:EKKAUFKRS: AND A.EKKAUFLFD = :EKKAUFLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QEKK05TST(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT A.EKKAUFKRS,A.EKKAUFLFD,A.EKKAUFKRS||'-'||TO_NUMBER(A.EKKAUFLFD) AS ORDNO,A.EKKLIEFNR,TRIM(C.LSLIEFNA) AS SUPP,C.LSLIEFDAT,WAFMINPMENG, "
                + " TO_CHAR(TO_DATE(A.EKKNEUD,'YYYYMMDD'),'MON-DD,YYYY') AS ORDDAT,TO_CHAR(SYSDATE,'MON-DD,YYYY') AS DAT,SUBSTR(A.EKKKOMMNR,1,3)||' '||A.EKKRSTBEZ AS DELT,SUBSTR(A.EKKKOMMNR,10,3) AS PAYMENT, "
                + " (SELECT STRAGG(T2.TXTKTEXT) FROM TXTIND T1,TXTKON T2 WHERE T1.TXTIMANDANT = T2.TXTKMANDANT AND T1.TXTIPIND = T2.TXTKPIND "
                + "  AND T1.TXTITXTART = 'ZAB' AND T1.TXTISIND LIKE SUBSTR(A.EKKKOMMNR,10,3)||'V%') AS PAYBEZ, "
                + " (select trim(substr(sddaten,2,20)) from sddat t where sdsa = '0149' and sdkey like a.Ekkmandant||A.EKKWAEHRSL||'%') as CURRENCY, "
                + " (select substr(sddaten,52,10) from sddat where sdsa = '0208' and sdkey like A.EKKMANDANT||SUBSTR(A.EKKKOMMNR,4,3)||'%V')AS TRS, "
                + " (SELECT TRIM(VBEZ) FROM VERSART V WHERE V.VMANDANT = A.EKKMANDANT AND VVERSART =SUBSTR(A.EKKKOMMNR,4,3) AND VSPED = SUBSTR(A.EKKKOMMNR,7,3) ) AS TRU, "
                + " STRAGG(DISTINCT TRIM(B.EKPTEXTKON))OVER(PARTITION BY A.EKKAUFKRS,A.EKKAUFLFD) AS TOLERANCE, "
                + " (SELECT NVL(MAX(TRIM(S.KDKUNDNA)),'') FROM ABAUFM f,VKKOPF k,KDSTAMM s "
                + " WHERE f.ABAAUFTYP ='B' AND f.ABAAUFKRS =A.EKKAUFKRS AND f.ABAAUFLFD = A.EKKAUFLFD AND f.ABAVKAUFTYP ='K' "
                + " AND f.ABAMANDANT = k.VKKMANDANT AND f.ABAVKAUFKRS = k.VKKAUFKRS AND f.ABAVKAUFLFD = k.VKKAUFLFD "
                + " AND k.VKKMANDANT = s.KDMANDANT AND k.VKKKUNDNR = s.KDKUNDNR) AS CUSTOMER, "
                + " (SELECT MAX(NVL(VKKSACHBE,'')) FROM ABAUFM f,VKKOPF k "
                + " WHERE f.ABAAUFTYP ='B' AND f.ABAAUFKRS =A.EKKAUFKRS AND f.ABAAUFLFD = A.EKKAUFLFD AND f.ABAVKAUFTYP ='K' "
                + " AND f.ABAMANDANT = k.VKKMANDANT AND f.ABAVKAUFKRS = k.VKKAUFKRS AND f.ABAVKAUFLFD = k.VKKAUFLFD) AS SACHBE, "
                + " (SELECT STRAGG(DISTINCT TRIM(T2.TXTKTEXT)) FROM TXTIND T1,TXTKON T2 WHERE T1.TXTIMANDANT = T2.TXTKMANDANT AND T1.TXTIPIND = T2.TXTKPIND "
                + " AND T1.TXTITXTART = 'EKP' AND T1.TXTISIND LIKE A.EKKAUFKRS||A.EKKAUFLFD||'%') AS REMARK, "
                + " NVL(TRIM(EKALNAME1)||TRIM(EKALNAME2),'') AS DELNAME,NVL(TRIM(EKALSTRASSE1)||TRIM(VKALSTRASSE2),'')AS DELADR, "
                + " (SELECT NVL(TRIM(K.KDANAME1)||TRIM(K.KDANAME2),'') FROM KUNDADR K WHERE E.EKAMANDANT = K.KDAMANDANT "
                + " AND E.EKALIEFNR3 = K.KDAKUNDNR AND E.EKAADRSL3 = K.KDAADRSL)AS INVNAME, "
                + " (SELECT NVL(TRIM(K.KDASTRASSE1)||TRIM(K.KDASTRASSE2),'') FROM KUNDADR K WHERE E.EKAMANDANT = K.KDAMANDANT "
                + " AND E.EKALIEFNR3 = K.KDAKUNDNR AND E.EKAADRSL3 = K.KDAADRSL)AS INVADR "
                + " FROM EKKOPF A,EKPOS B,LIEFDAT C,EKADR E ,ABAUFM "
                + " LEFT JOIN VKPOS ON  ABAVKAUFKRS = VKPAUFKRS AND ABAVKAUFLFD = VKPAUFLFD AND ABAVKAUFPOS = VKPAUFPOS "
                + " LEFT JOIN WASTAMM ON TRIM(VKPART)=TRIM(WAART) "
                + " WHERE A.EKKMANDANT = B.EKPMANDANT AND A.EKKAUFKRS = B.EKPAUFKRS "
                + " AND A.EKKAUFLFD = B.EKPAUFLFD AND B.EKPSA='PO' "
                + " AND A.EKKMANDANT = C.LSMANDANT AND A.EKKLIEFNR = C.LSLIEFNR "
                + " AND ABAAUFTYP='B' AND ABAMANDANT=B.EKPMANDANT AND ABAAUFKRS=B.EKPAUFKRS AND ABAAUFLFD=B.EKPAUFLFD AND ABAAUFPOS=B.EKPAUFPOS AND ABAAUFTYP='B' AND ABAVKAUFTYP = 'K' "
                + " AND A.EKKMANDANT = E.EKAMANDANT AND A.EKKAUFKRS = E.EKAAUFKRS AND A.EKKAUFLFD = E.EKAAUFLFD AND E.EKAAUFPOS ='000' "
                + " AND A.EKKMANDANT = :EKKMANDANT: AND A.EKKAUFKRS =:EKKAUFKRS: AND A.EKKAUFLFD = :EKKAUFLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
    }
}
